package com.spzx.user.service.impl;

import com.spzx.common.security.utils.SecurityUtils;
import com.spzx.user.domain.UserBrowseHistory;
import com.spzx.user.mapper.UserBrowseHistoryMapper;
import com.spzx.user.service.IUserBrowseHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户浏览记录表 服务实现类
 * </p>
 *
 * @author atguigu
 * @since 2024-11-18
 */
@Service
public class UserBrowseHistoryServiceImpl extends ServiceImpl<UserBrowseHistoryMapper, UserBrowseHistory> implements IUserBrowseHistoryService {

    @Override
    public void saveUserBrowseHistory(Long skuId) {
        UserBrowseHistory userBrowseHistory = new UserBrowseHistory();
        userBrowseHistory.setUserId(SecurityUtils.getUserId());
        userBrowseHistory.setSkuId(skuId);
        userBrowseHistory.setCreateBy(SecurityUtils.getUsername());
        baseMapper.insert(userBrowseHistory);
    }
}
